package com.fnst.caesar.servlet;

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

import org.apache.ibatis.session.*;

import com.fnst.caesar.bean.*;
import com.fnst.caesar.util.*;
/**
 * Servlet implementation class PointLog_Servlet
 */
public class PointLog_Servlet extends HttpServlet
{
	private static final long serialVersionUID = 1L;
	
	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public PointLog_Servlet()
	{
		super();
		// TODO Auto-generated constructor stub
	}
	
	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException
	{
		// TODO Auto-generated method stub
		doPost(request, response);
	}
	
	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException
	{
		// TODO Auto-generated method stub
		String user_id = (String)request.getSession(true).getAttribute("user_id")+"";
		
		SqlSessionFactory ssf = SqlFactoryUtil.getSqlSessionFactory(request);
		SqlSession sqlSession = ssf.openSession();
		List queryResult = sqlSession.selectList("com.fnst.caesar.mapper.selectPointLogByUserId", user_id);
		
		request.setAttribute("queryResult", queryResult);
		request.getRequestDispatcher("/WEB-INF/WEB/Point_Log.jsp").forward(request, response);
	}
	
}
